<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        @keyframes ani {    /*ani是自定义动画的名字*/
            0% {
                transform: translate(20px, 0) scale(1.5, 1);
            }
            30% {
                transform: translate(50px, 0) scale(1, 1)
            }
            50% {
                transform: translate(50px, 50px) scale(1, 1)
            }
            70% {
                transform: translate(0, 50px) scale(2, 1)
            }
            100% {
                transform: translate(0, 0) scale(2, 2)
            }
        }
        div.box {
            margin: 100px auto;
            width: 100px;
            height: 100px;
            background-color: #ff5700;
            line-height: 100px;
            text-align: center;
            color: #fff;
            transform: translate(0, 0) scale(1);
        }

        div.box:active {
            animation-name: ani;
            animation-duration: 3s;
            animation-timing-function: ease;
            animation-iteration-count: 3;
        }

    </style>
</head>
<body>
    <div class="box">
        1
    </div>
</body>
</html>